From: Alessandro Bono Date: Wed, 3 Aug 2022 13:08:07 +0000 (+0200) Subject: gdmUtil: Collect services that determine the username in one place X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~405^2^2~161 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8e081a14d5af7c298463e1ec44906d8951148003;p=gnome-shell.git gdmUtil: Collect services that determine the username in one place Doing so, extensions don't need to reimplement entirely the AuthPrompt.reset() function just for adding their own credential service in the foreground service check. Part-of: --- diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 3b1fa805a..97b12ef54 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -7,8 +7,6 @@ const Animation = imports.ui.animation; const AuthList = imports.gdm.authList; const Batch = imports.gdm.batch; const GdmUtil = imports.gdm.util; -const OVirt = imports.gdm.oVirt; -const Vmware = imports.gdm.vmware; const Params = imports.misc.params; const ShellEntry = imports.ui.shellEntry; const UserWidget = imports.ui.userWidget; @@ -630,9 +628,7 @@ var AuthPrompt = GObject.registerClass({ if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED) return; beginRequestType = BeginRequestType.PROVIDE_USERNAME; - } else if (this._userVerifier.serviceIsForeground(OVirt.SERVICE_NAME) || - this._userVerifier.serviceIsForeground(Vmware.SERVICE_NAME) || - this._userVerifier.serviceIsForeground(GdmUtil.SMARTCARD_SERVICE_NAME)) { + } else if (this._userVerifier.foregroundServiceDeterminesUsername()) { // We don't need to know the username if the user preempted the login screen // with a smartcard or with preauthenticated oVirt credentials beginRequestType = BeginRequestType.DONT_PROVIDE_USERNAME; diff --git a/js/gdm/util.js b/js/gdm/util.js index 43647e7ac..1c2a40cd6 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -522,6 +522,15 @@ var ShellUserVerifier = class extends Signals.EventEmitter { return serviceName == this._getForegroundService(); } + foregroundServiceDeterminesUsername() { + for (let serviceName in this._credentialManagers) { + if (this.serviceIsForeground(serviceName)) + return true; + } + + return this.serviceIsForeground(SMARTCARD_SERVICE_NAME); + } + serviceIsDefault(serviceName) { return serviceName == this._defaultService; }